﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication2
{
    public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Grade grade1 = new Grade();

            grade1.SetChineseGrade(double.Parse(textBox1.Text));
            grade1.SetMathGrade(double.Parse(textBox2.Text));
            grade1.SetEnglishGrade(double.Parse(textBox3.Text));

            richTextBox1.Text = grade1.Display();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Grade grade2 = new Grade();

            grade2.SetChineseGrade(double.Parse(textBox1.Text));
            grade2.SetMathGrade(double.Parse(textBox2.Text));
            grade2.SetEnglishGrade(double.Parse(textBox3.Text));

            textBox4.Text = Convert.ToString(grade2.AverageGrade());
        }
    }
}
